package com.lanzuo.pana.adapter.client.watcher;

import com.lanzuo.pana.adapter.config.SpringContextHolder;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

/**
 * @author eric
 * @description smb配置项，从配置文件、redis中获取
 */
@Data
@Builder
@AllArgsConstructor
public class SshConfig {
    private String host;
    private Integer port;
    private String username;
    private String password;
    private String remotePath;
    private String logType;
    private String extraArgs;

    public static SshConfig newConfig() {
        SshConfig config = SshConfig.builder()
                .host(SpringContextHolder.getProperty("collect.ssh.host", ""))
                .port(Integer.parseInt(SpringContextHolder.getProperty("collect.ssh.port", "0")))
                .username(SpringContextHolder.getProperty("collect.ssh.username", ""))
                .password(SpringContextHolder.getProperty("collect.ssh.password", ""))
                .remotePath(SpringContextHolder.getProperty("collect.ssh.remotePath", ""))
                .logType(SpringContextHolder.getProperty("collect.ssh.logType", ""))
                .extraArgs(SpringContextHolder.getProperty("collect.ssh.extraArgs", ""))
                .build();
        return config;
    }

//    /**
//     * 测试使用
//     */
//    @PostConstruct
//    public void init() {
//        // 初始化获取文件、redis配置
////        username = "pfscuser";
////        password = "pfsc#lnb01";
////        host = "192.168.10.10";
////        port = 16;
////        remotePath = "/lnbroot/othersystem/ProViewer";
//
//        host = "192.168.50.244";
//        port = 22;
//        username = "root";
//        password = "lanzuo@2021";
//        // 要读取的远程目录
//        remotePath = "/docker/shareFolder/eric_zheng_file_backup/20250531/UX/test";
//    }
}
